package com.yksj.healthtalk.ui.server;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.View.OnClickListener;

import com.yksj.healthtalk.comm.BaseFragmentActivity;
import com.yksj.healthtalk.ui.R;

/**
 * 服务中心
 * @author tly
 */
public class ServerCenterHomeActivity extends BaseFragmentActivity implements OnClickListener {
	
	private int mType;
	private String id;//商户id
	
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		
		setContentView(R.layout.server_center_layout);
		mType = getIntent().getIntExtra("type",1);
		id=getIntent().getStringExtra("id");
		initView();
	}
	
	private void initView(){
		initTitle();
		titleLeftBtn.setOnClickListener(this);
		initFragment();
	}
	
	private void initFragment(){
		FragmentManager fm = getSupportFragmentManager();
		FragmentTransaction ft = fm.beginTransaction();
		Fragment fragment = null;
		fragment = ServerCenterHomeFragment.instantiate(this, ServerCenterHomeFragment.class.getName());
		titleTextV.setText(getIntent().getStringExtra("title"));
		Bundle bundle=new Bundle();
		bundle.putString("id",id);
		bundle.putString("title",getIntent().getStringExtra("title"));
		fragment.setArguments(bundle);
		ft.add(R.id.fragmentcontent,fragment);
		ft.commit();
	}

	@Override
	public void onClick(View v) {
		switch(v.getId()){
		case R.id.title_back:
			finish();
			overridePendingTransition(R.anim.back_enter, R.anim.back_exit);
			break;
		}
	}
}
